\(\int (B \cos (c+d x)+C \cos ^2(c+d x)) \sec (c+d x) \, dx\) [220]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 15 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=B x+\frac {C \sin (c+d x)}{d} \]

[Out]

B*x+C*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {3089, 2717} \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=B x+\frac {C \sin (c+d x)}{d} \]

[In]

Int[(B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x],x]

[Out]

B*x + (C*Sin[c + d*x])/d

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3089

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x
_Symbol] :> Dist[1/b, Int[(b*Sin[e + f*x])^(m + 1)*(B + C*Sin[e + f*x]), x], x] /; FreeQ[{b, e, f, B, C, m}, x
]

Rubi steps \begin{align*} \text {integral}& = \int (B+C \cos (c+d x)) \, dx \\ & = B x+C \int \cos (c+d x) \, dx \\ & = B x+\frac {C \sin (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.73 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=B x+\frac {C \cos (d x) \sin (c)}{d}+\frac {C \cos (c) \sin (d x)}{d} \]

[In]

Integrate[(B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x],x]

[Out]

B*x + (C*Cos[d*x]*Sin[c])/d + (C*Cos[c]*Sin[d*x])/d

Maple [A] (verified)

Time = 1.98 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.07

method result size
risch \(x B +\frac {C \sin \left (d x +c \right )}{d}\) \(16\)
parallelrisch \(\frac {d x B +\sin \left (d x +c \right ) C}{d}\) \(18\)
derivativedivides \(\frac {\sin \left (d x +c \right ) C +B \left (d x +c \right )}{d}\) \(21\)
default \(\frac {\sin \left (d x +c \right ) C +B \left (d x +c \right )}{d}\) \(21\)
parts \(\frac {B \left (d x +c \right )}{d}+\frac {C \sin \left (d x +c \right )}{d}\) \(23\)
norman \(\frac {x B +x B \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {2 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 C \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+2 x B \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(82\)

[In]

int((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x,method=_RETURNVERBOSE)

[Out]

x*B+C*sin(d*x+c)/d

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {B d x + C \sin \left (d x + c\right )}{d} \]

[In]

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="fricas")

[Out]

(B*d*x + C*sin(d*x + c))/d

Sympy [F]

\[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int \left (B + C \cos {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]

[In]

integrate((B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c),x)

[Out]

Integral((B + C*cos(c + d*x))*cos(c + d*x)*sec(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.33 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {{\left (d x + c\right )} B + C \sin \left (d x + c\right )}{d} \]

[In]

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="maxima")

[Out]

((d*x + c)*B + C*sin(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (15) = 30\).

Time = 0.29 (sec) , antiderivative size = 39, normalized size of antiderivative = 2.60 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {{\left (d x + c\right )} B + \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1}}{d} \]

[In]

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="giac")

[Out]

((d*x + c)*B + 2*C*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 1.14 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.13 \[ \int \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {C\,\sin \left (c+d\,x\right )+B\,d\,x}{d} \]

[In]

int((B*cos(c + d*x) + C*cos(c + d*x)^2)/cos(c + d*x),x)

[Out]

(C*sin(c + d*x) + B*d*x)/d